﻿using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;

namespace YJKCopyModel.DuctFastModel
{
	public class GetRevitProjectData
	{
		public static Dictionary<string, Element> GetAllDuctSystem(Autodesk.Revit.DB.Document doc)
		{
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
			FilteredElementCollector filteredElementCollector2 = filteredElementCollector.OfCategory(BuiltInCategory.OST_DuctSystem).OfClass(typeof(MechanicalSystemType));
			Dictionary<string, Element> dictionary = new Dictionary<string, Element>();
			List<Element> list = filteredElementCollector2.ToElements().ToList<Element>();
			foreach (Element element in list)
			{
				dictionary.Add(element.Name, element);
			}
			return dictionary;
		}

		public static Dictionary<string, Element> GetAllDuctType(Autodesk.Revit.DB.Document doc)
		{
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
			Dictionary<string, Element> dictionary = new Dictionary<string, Element>();
			List<Element> list = filteredElementCollector.OfClass(typeof(DuctType)).ToElements().ToList<Element>();
			foreach (Element element in list)
			{
				DuctType ductType = (DuctType)element;
				dictionary.Add(ductType.FamilyName + ":" + ductType.Name, ductType);
			}
			return dictionary;
		}
	}
}
